﻿

import Request from '../../base/request.js?t=202511041006'
import Storage from '../../base/storage.js?t=202511041006'
import {  getBrowserInfo, getRecentYears} from "../../base/utils.js?t=202511041006"
const Composition = (proxy) => {
    const data = reactive({
        messageTest:"",

        templateOpen:false, 
        settingList:[],
        CalcType:0,
        list: [
           
                
           
        ],
        /*        dateTypeList: [{ label: '月度模板', value: 0 }, { label: '年度模板', value: 1 }],*/
        dateTypeList: [{ label: '年度模板', value: 1 },{ label: '月度模板', value: 0 },],
        tabList: [{ label: '履职考核考评表', value: 1 }, { label: '重点工作报表', value: 2 }, { label: '现场检查报表', value: 3 } ],
        cDateIndex:1,
        cIndex: 1,
        proxy: "",
        opType:0,
        confirmShow: false,
        delId: "",
  

        pagination: {
            total: 0,
            current: 1,
            loading:false,
            pageSize: 10,
            showTotal: total => `总共 ${total} 项`,
            defaultPageSize: 10,
            // pageSizeOptions: ['5', '10', '15', '20'], // 可不设置使用默认
            showSizeChanger: true, // 是否显示pagesize选择
            showQuickJumper: false, // 是否显示跳转窗
        },
     

        formState: {
            CategoryName: "",
            TypeId: "",
            Years: "",
            "Period": "1",
            "Percent": 100,
            Score: "",
            SortBy: "",
            CalcType: 0,
        },
        formState2: {
            SubCategoryName: "",
            CategoryId:"",
            "Percent": 100,
            Score: "",
            SortBy: "",
            CalcType: 0,
        },
        formState3: {
            SubcategoryId: "",
            CheckContent: "",
            "Evidences": "",
            MethodType:"",
            Score: "",
            SortBy: "",
            CalcType:0,
        },

        formState4: {
            CheckContent: "",
            SortBy: "",
        },

        rules: {
            CategoryName: [{ required: true, message: '请填写标题', trigger: 'change' }],
            Score: [{ required: true, message: '请填写分数', trigger: 'change' }],
            Years: [{ required: true, message: '请选择年份', trigger: 'change' }],
            SortBy: [{ required: true, message: '请选择排序', trigger: 'change' }],
        },
        rules2: {
            SubCategoryName: [{ required: true, message: '请填写标题', trigger: 'change' }],
            Score: [{ required: true, message: '请填写分数', trigger: 'change' }],
          
            SortBy: [{ required: true, message: '请选择排序', trigger: 'change' }],
        },
        rules3: {
            CategoryName: [{ required: true, message: '请填写标题', trigger: 'change' }],
            Score: [{ required: true, message: '请填写分数', trigger: 'change' }],
            Years: [{ required: true, message: '请选择年份', trigger: 'change' }],
            SortBy: [{ required: true, message: '请选择排序', trigger: 'change' }],
            Score: [{ required: true, message: '请选择分数', trigger: 'change' }],


        },
        rules4: {
            CheckContent: [{ required: true, message: '请填写标题', trigger: 'change' }],
            SortBy: [{ required: true, message: '请选择排序', trigger: 'change' }],
        },
        fileOpen:false,

        levelType:1,


        open:false,
    
 
        queryParams: {
            year: "",
            month: "",
        },


        first: true,
        yearList: [
            { label: '2023', value: '2023' },
            { label: '2024', value: '2024' },
            { label: '2025', value: '2025' }
        ],
        monthList: [
            { label: '1月', value: 1 },
            { label: '2月', value: 2 },
            { label: '3月', value: 3 },
            { label: '4月', value: 4 },
            { label: '5月', value: 5 },
            { label: '6月', value: 6 },
            { label: '7月', value: 7 },
            { label: '8月', value: 8 },
            { label: '9月', value: 9 },
            { label: '10月', value: 10 },
            { label: '11月', value: 11 },
            { label: '12月', value: 12 },
        ],
        columns1: [
            {
                title: '序号',
                dataIndex: 'a',
                key: 'a',
                align: 'center',
                width: 80,
                customRender: ({ index, record }) => {
                    return record.SortBy
                },
            },
            {
                title: '年份',
                dataIndex: 'Years',
                key: 'Years',
                align: 'center'

            },
            {
                title: '类型',
                dataIndex: 'TypeName',
                key: 'TypeName',
                align: 'center'

            },
            {
                title: '一级标题',
                dataIndex: 'CategoryName',
                key: 'CategoryName',
                align: 'center'

            },
            {
                title: '二级标题',
                dataIndex: 'SubCategoryCount',
                key: 'SubCategoryCount',
                align: 'center'
            },
            {
                title: '分数',
                dataIndex: 'Score',
                key: 'Score',
                align: 'center'
            },
            {
                title: '更新时间',
                dataIndex: 'UpdateTime',
                key: 'UpdateTime',
                align: 'center',
                customRender: function ({ text }) {
                    const regex = /\/Date\((\d+)\)\//;
                    const match = text && text.match(regex);
                    if (match) {
                        let res = dayjs(parseInt(match[1], 10)).format('YYYY-MM-DD HH:mm')
                        return res
                    } else {
                        return ""
                    }
                }
            },
            {
                title: '更新人',
                dataIndex: 'CreateUserName',
                key: 'CreateUserName',
                align: 'center'
            },
            {
                title: '操作',
                key: 'action',
                align: 'center',
                customRender: function ({ text, record, index, column }) {
                    return h("div", {
                    },
                        [h(antd.Button, {
                            style: 'margin-right:4px',
                            type: "link",
                            onClick: () => { methods.handleLevel2(record)}
                        }, { default: () => '二级指标' }), h(antd.Button, {
                            style: 'margin-right:4px',
                            type: "link",
                            onClick: () => {
                                methods.handleDialog(1, record.Id)
                            }
                        }, { default: () => '编辑' }),
                            h(antd.Button, {
                            style: 'margin-right:4px',
                                type: "link",
                                danger: true,
                                onClick: () => {
                                    methods.delData(record.Id)
                                }
                        }, { default: () => '删除' }), h(antd.Button, {
                            style: 'margin-right:4px',
                            type: "link",
           
                            onClick: () => {
                                methods.handleDialog(2, record.Id)
                            }
                        }, { default: () => '详情' })]
                    );

                }
            },
        ],
        columns2: [
            {
                title: '序号',
                dataIndex: 'a',
                key: 'a',
                align: 'center',
                width: 80,
                customRender: ({ index }) => {
                    return (params.pagination.value.current - 1) * params.pagination.value.pageSize + index + 1
                },
            },
            {
                title: '二级标题',
                dataIndex: 'SubCategoryName',
                key: 'SubCategoryName',
                align: 'center'

            },
            {
                title: '内容指标',
                dataIndex: 'CheckContentCount',
                key: 'CheckContentCount',
                align: 'center'
            },
            {
                title: '更新时间',
                dataIndex: 'UpdateTime',
                key: 'UpdateTime',
                align: 'center',
                customRender: function ({ text, record, index, column }) {
                    const regex = /\/Date\((\d+)\)\//;
                    const match = text && text.match(regex);
                    if (match) {
                        let res = dayjs(parseInt(match[1], 10)).format('YYYY-MM-DD HH:mm')
                        return res
                    } else {
                        return ""
                    }

                }
            },
            {
                title: '更新人',
                dataIndex: 'CreateUserName',
                key: 'CreateUserName',
                align: 'center'
            },
            {
                title: '操作',
                key: 'action',
                align: 'center',
                customRender: function ({ text, record, index, column }) {
                    return h("div", {
                    },
                        [h(antd.Button, {
                            style: 'margin-right:4px',
                            type: "link",
                            onClick: () => { methods.handleLevel3(record) }
                        }, { default: () => '内容指标' }), h(antd.Button, {
                            style: 'margin-right:4px',
                            type: "link",
                            onClick: () => {
                                methods.handleDialog(1, record.Id)
                            }
                        }, { default: () => '编辑' }), h(antd.Button, {
                            style: 'margin-right:4px',
                            type: "link",
                            onClick: () => {
                                methods.handleDialog(2, record.Id)
                            }
                        }, { default: () => '详情' }), h(antd.Button, {
                            style: 'margin-right:4px',
                            type: "link",
                            onClick: () => {
                                methods.delData(record.Id)
                            }
                        }, { default: () => '删除' })]
                    );

                }
            },
        ],
        columns3: [
            {
                title: '序号',
                dataIndex: 'a',
                key: 'a',
                align: 'center',
                width: 80,
                customRender: ({ index}) => {
                    return (params.pagination.value.current - 1) * params.pagination.value.pageSize + index + 1
                },
            },
            {
                title: '考核内容',
                dataIndex: 'CheckContent',
                key: 'CheckContent',
                align: 'center'

            },
            {
                title: '考核方式',
                dataIndex: 'MethodType',
                key: 'MethodType',
                align: 'center'
            },
            {
                title: '备查/佐证资料',
                dataIndex: 'Evidences',
                key: 'Evidences',
                align: 'center'
            },
            {
                title: '更新时间',
                dataIndex: 'UpdateTime',
                key: 'UpdateTime',
                align: 'center',
                customRender: function ({ text, record, index, column }) {
                    const regex = /\/Date\((\d+)\)\//;
                    const match = text && text.match(regex);
                    if (match) {
                        let res = dayjs(parseInt(match[1], 10)).format('YYYY-MM-DD HH:mm')
                        return res
                    } else {
                        return ""
                    }

                }
            },
            {
                title: '更新人',
                dataIndex: 'CreateUserName',
                key: 'CreateUserName',
                align: 'center'
            },
      
       
            {
                title: '操作',
                key: 'action',
                align: 'center',
                customRender: function ({ text, record, index, column }) {
                    return h("div", {
                    },
                        [ h(antd.Button, {
                            style: 'margin-right:4px',
                            type: "link",
                            onClick: () => {
                                methods.handleDialog(1, record.Id)
                            }
                        }, { default: () => '编辑' }), h(antd.Button, {
                            style: 'margin-right:4px',
                            type: "link",
                            onClick: () => {
                                methods.handleDialog(2, record.Id)
                            }
                        }, { default: () => '详情' }), h(antd.Button, {
                            style: 'margin-right:4px',
                            type: "link",
                            onClick: () => {
                                methods.delData(record.Id)
                            }
                        }, { default: () => '删除' })]
                    );

                }
            },
        ],
        dataSource1: [],
        dataSource2: [],
        dataSource3: [],


        Mcolumns: [
            {
                title: '序号',
                dataIndex: 'index',
                key: 'index',
                align: 'center',
                width: 80,
                customRender: ({ index, record }) => {
                    return record.SortBy
                },
            },
            {
                title: '模块名称',
                dataIndex: 'CheckContent',
                key: 'CheckContent',
                align: 'center'
            },
            {
                title: '更新时间',
                dataIndex: 'UpdateTime',
                key: 'UpdateTime',
                align: 'center',
                customRender: function ({ text, record, index, column }) {
                    const regex = /\/Date\((\d+)\)\//;
                    const match = text && text.match(regex);
                    if (match) {
                        let res = dayjs(parseInt(match[1], 10)).format('YYYY-MM-DD HH:mm')
                        return res
                    } else {
                        return ""
                    }

                }
            },
            {
                title: '操作',
                key: 'action',
                align: 'center',
                customRender: function ({  record }) {
                    const FDBtn = h(antd.Popconfirm, {
                        title: "确定删除?",
                        onConfirm: () => methods.handleMDelete(record)

                    }, { default: () => [delBtn] })

                    let detailBtn = h(antd.Button, {
                        type: "link",
                        onClick: () => methods.handleDialog(2, record.Id, true, record)
                    }, { default: () => '详情' })

                    let editBtn = h(antd.Button, {
                        type: "link",
                        onClick: () => methods.handleDialog(1, record.Id, true, record)
                    }, { default: () => '编辑' })

                    let delBtn = h(antd.Button, {
                        type: "link",

                    }, { default: () => '删除' })


                    return h(antd.Space, {

                    },
                        { default: () => [editBtn, FDBtn, detailBtn] }
                    );

                }
            },
        ],

        MdataSource:[]

    })
    let params = toRefs(data)



    const methods = {

        handleTableChange: ({ current, pageSize }) => {

            params.pagination.value.current = current;
            params.pagination.value.pageSize = pageSize;
            methods.getTableList()
        },
        //handleAdd: () => {
        //    params.settingList.value.push({
        //        name:""
        //    })
        //},









        handleMDelete: (item) => {
            params.pagination.value.loading = true
            Request({
                url: "/Performance/DeleteMonthTemplete",
                method: 'post',
                data: {
                    Id: item.Id
                }
            }).then(res => {
                params.messageTest.value.success(res.Msg);

                methods.getTableList(true)

            }).finally(() => {
                params.pagination.value.loading=false
            })
        },
        handleTemplate: () => {
            params.templateOpen.value = false
        },

        queryList: () => {
            methods.getTableList(true)
        },

        return: () => {
            params.levelType.value -= 1
        },
        delData: (id) => {

            params.delId.value = id
            params.confirmShow.value = true

        },
        handleDialog: (type, id,flag,item) => {

            params.opType.value = type
            if (flag) {

                if (type != 0) {
                    params.formState4.value = JSON.parse(JSON.stringify(item))
                }
          

                return params.open.value = true
            }

            if (type == 0) {



                if (params.levelType.value == 1) {


                    //新增一级



                    params.formState.value.CategoryName = ""
                    params.formState.value.Years = ""
                    params.formState.value.Score = ""
                    params.formState.value.SortBy = ""

                    



                }



                if (params.levelType.value == 2) {
                    //新增二级




                    params.formState2.value.SubCategoryName = ""
                    params.formState2.value.MethodType = ""
                    params.formState2.value.Score = ""
                    params.formState2.value.SortBy = ""
                }


                if (params.levelType.value == 3) {
                    //新增内容

                    params.formState3.value.CheckContent = ""
                    params.formState3.value.Evidences = ""
                    params.formState3.value.MethodType = ""
                    params.formState3.value.Score = ""
                    params.formState3.value.SortBy = ""
                }


            }
            else {

                //params.SubCategoryCount.value = item.SubCategoryCount


                if (params.levelType.value == 1) {


                    Request({
                        url: "/Performance/GetPerformanceCategoryDetail",
                        method: 'post',
                        data: {
                            Id: id
                        }
                    }).then(res => {
                        let data = res.Data
                        params.formState.value = data



                    })

                }

                if (params.levelType.value == 2) {
                    Request({
                        url: "/performance/GetPerformanceSubcategoryDetail",
                        method: 'post',
                        data: {
                            Id: id
                        }
                    }).then(res => {
                        let data = res.Data
                        params.formState2.value = data



                    })

                }


                if (params.levelType.value == 3) {
                    Request({
                        url: "/performance/GetPerformanceContentDetail",
                        method: 'post',
                        data: {
                            Id: id
                        }
                    }).then(res => {
                        let data = res.Data
                        params.formState3.value = data



                    })

                }







                //修改

            }
            //opType  0 新增  1 修改 2详情

            params.open.value = true
        },


        handleconfirmOk: () => {





            if (params.levelType.value == 1) {



                Request({
                    url: "/Performance/DeletePerformanceCategory",
                    method: 'post',
                    data: {
                        Id: params.delId.value
                    }
                }).then(res => {
                    params.messageTest.value.success(res.Msg);
                    params.messageTest.value.success(res.Msg);
                    methods.init()

                }).finally(() => {
                    params.confirmShow.value = false
                })

            }

            if (params.levelType.value == 2) {

                Request({
                    url: "/performance/DeletePerformanceSubategory",
                    method: 'post',
                    data: {
                        Id: params.delId.value
                    }
                }).then(res => {

                    params.messageTest.value.success(res.Msg);
                    methods.init()

                }).finally(() => {
                    params.confirmShow.value = false
                })

            }


            if (params.levelType.value == 3) {

                Request({
                    url: "/performance/DeletePerformanceContent",
                    method: 'post',
                    data: {
                        Id: params.delId.value
                    }
                }).then(res => {

                    params.messageTest.value.success(res.Msg);
                    methods.init()

                }).finally(() => {
                    params.confirmShow.value = false
                })

            }






        },

        handleOk: () => {
            params.pagination.value.loading = true
            if (params.cDateIndex.value == 0) {




          




                if (params.opType.value == 0) {

                    params.proxy.value.$refs.formRef.validate()
                        .then(() => {
                            Request({
                                url: "/Performance/AddMonthTemplete",
                                method: 'post',
                                data:
                                    params.formState4.value

                            }).then(res => {
                                params.messageTest.value.info(res.Msg);
                                params.pagination.value.loading = false


                                methods.getTableList(true)

                                params.open.value = false
                            })

                }).catch(error => {
                    params.pagination.value.loading = false
                    if (error.errorFields.length != 0) {
                        params.messageTest.value.warn(error.errorFields[0].errors[0])
                    }

                });



                
                } else {

                    if (params.opType.value == 2) {
                        params.pagination.value.loading = false
                        return params.open.value = false
                    }


                    params.proxy.value.$refs.formRef.validate()
                        .then(() => {
                            Request({
                                url: "/performance/EditMonthTemplete",
                                method: 'post',
                                data:
                                    params.formState4.value

                            }).then(res => {
                                params.messageTest.value.info(res.Msg);
                                params.pagination.value.loading = false


                                methods.getTableList(true)

                                params.open.value = false
                            })
                        }).catch(error => {
                            params.pagination.value.loading = false
                            if (error.errorFields.length != 0) {
                                params.messageTest.value.warn(error.errorFields[0].errors[0])
                            }

                        });

            


                }


     
                return 
            }

            params.formState.value.TypeId = params.cIndex.value
            switch (+params.levelType.value) {
                case 1:
                    params.proxy.value.$refs.formRef.validate()
                        .then(() => {
                            if (params.opType.value == 0) {
                                Request({
                                    url: "/performance/AddPerformanceCategory",
                                    method: 'post',
                                    data:
                                        params.formState.value

                                }).then(res => {
                                    params.messageTest.value.info(res.Msg);
                                    params.pagination.value.loading = false
                                    methods.getTableList(true)
                                    params.open.value = false
                                })
                            } else {

                                if (params.opType.value == 2) {
                                    params.pagination.value.loading = false
                                    return params.open.value = false
                                }

                                Request({
                                    url: "/performance/EditPerformanceCategory",
                                    method: 'post',
                                    data:
                                        params.formState.value

                                }).then(res => {
                                    params.messageTest.value.info(res.Msg);

                                    params.pagination.value.loading = false

                                    methods.getTableList(true)

                                    params.open.value = false
                                })


                            }
                        }).catch(error => {
                            console.log(error, 'error')
                            if (error.errorFields.length != 0) {
                                params.messageTest.value.warn(error.errorFields[0].errors[0])
                            }

                        });
                    break;
                case 2:



                    params.proxy.value.$refs.formRef.validate()
                        .then(() => {
                            if (params.opType.value == 0) {
                                Request({
                                    url: "/performance/AddPerformanceSubcategory",
                                    method: 'post',
                                    data:
                                        params.formState2.value

                                }).then(res => {

                                    params.messageTest.value.info(res.Msg);
                                    params.pagination.value.loading = false
                                    methods.getTableList(true)
                                    params.open.value = false
                                })
                            } else {

                                if (params.opType.value == 2) {
                                    params.pagination.value.loading = false
                                    return params.open.value = false
                                }

                                Request({
                                    url: "/performance/EditPerformanceSubcategory",
                                    method: 'post',
                                    data:
                                        params.formState2.value

                                }).then(res => {
                                    params.messageTest.value.info(res.Msg);
                                    params.pagination.value.loading = false




                                    params.open.value = false
                                })


                            }
                        }).catch(error => {
                            console.log(error, 'error')
                            if (error.errorFields.length != 0) {
                                params.messageTest.value.warn(error.errorFields[0].errors[0])
                            }

                        });
                    break;

                case 3:




                    params.proxy.value.$refs.formRef.validate()
                        .then(() => {
                            if (params.opType.value == 0) {
                                Request({
                                    url: "/performance/AddPerformanceContent",
                                    method: 'post',
                                    data:
                                        params.formState3.value

                                }).then(res => {
                                    params.messageTest.value.info(res.Msg);
                                    params.pagination.value.loading = false

                                    params.open.value = false
                                })
                            } else {


                                if (params.opType.value == 2) {
                                    params.pagination.value.loading = false
                                    return params.open.value = false
                                }
                                Request({
                                    url: "/performance/EditPerformanceContent",
                                    method: 'post',
                                    data:
                                        params.formState3.value

                                }).then(res => {
                                    params.messageTest.value.info(res.Msg);

                                    params.pagination.value.loading = false



                                    params.open.value = false
                                })


                            }
                        }).catch(error => {
                            console.log(error, 'error')
                            if (error.errorFields.length != 0) {
                                params.messageTest.value.warn(error.errorFields[0].errors[0])
                            }

                        });
                    break;
                default:

            }




            methods.init()




        },

        tabTypeClick: (e) => {
            params.cDateIndex.value = e
            Storage.set(`${window.location.pathname}Index`, params.cDateIndex.value, true)
            params.queryParams.value = {
    
            }
            methods.getTableTypeList()
        },

        tabClick: (e) => {
            params.cIndex.value = e
            methods.getTableList(true)
        },


        getTableList: (isRresh) => {

            if (isRresh) {
                params.pagination.value.current = 1
            }
            params.pagination.value.loading = true


            if (params.cDateIndex.value == 1) {
                if (params.levelType.value == 1) {
                    Request({
                        url: "/Performance/GetCategoryPageList",
                        method: 'post',
                        params: {
                            page: params.pagination.value.current,
                            pageSize: params.pagination.value.pageSize
                        },
                        data: {
                            Years: params.queryParams.value.year,
                            TypeId: params.cIndex.value
                        }
                    }).then(res => {
                        //params.messageTest.value.info(res.Msg);


                        params.dataSource1.value = res.Data.Data
                        params.pagination.value.total = res.Data.TotalItemCount
                        params.pagination.value.loading = false
                    })

                }

                if (params.levelType.value == 2) {
                    Request({
                        url: "/performance/GetSubcategoryPageList",
                        method: 'post',
                        params: {
                            page: params.pagination.value.current,
                            pageSize: params.pagination.value.pageSize
                        },
                        data: {
                            Years: params.queryParams.value.year,
                            TypeId: params.cIndex.value,
                            CategoryId: params.formState2.value.CategoryId
                        }
                    }).then(res => {
                        //params.messageTest.value.info(res.Msg);

                        params.dataSource2.value = res.Data.Data
                        params.pagination.value.total = res.Data.TotalItemCount
                        params.pagination.value.loading = false
                    })

                }
                if (params.levelType.value == 3) {
                    Request({
                        url: "/performance/GetContentPageList",
                        method: 'post',
                        params: {
                            page: params.pagination.value.current,
                            pageSize: params.pagination.value.pageSize,
                            SubcategoryId: params.formState3.value.SubcategoryId
                        },
                        data: {
                            Years: params.queryParams.value.year,
                            TypeId: params.cIndex.value
                        }
                    }).then(res => {
                        //params.messageTest.value.info(res.Msg);

                        params.dataSource3.value = res.Data.Data
                        params.pagination.value.total = res.Data.TotalItemCount
                        params.pagination.value.loading = false

                    })

                }


            } else {
                Request({
                    url: "/performance/GetMonthTempletePageList",
                    method: 'post',
                    params: {
                        page: params.pagination.value.current,
                        pageSize: params.pagination.value.pageSize,
                     
                    },
              
                }).then(res => {
                    //params.messageTest.value.info(res.Msg);

                    params.MdataSource.value = res.Data.Data
                    params.pagination.value.total = res.Data.TotalItemCount
                    params.pagination.value.loading = false

                })

                ///Performance/GetMonthTempletePageList
            }


      

        },

        fileShow: () => {
            params.fileOpen.value = true
        },
        handleLevel2: (item) => {

            params.levelType.value = 2

            console.log(item, 'item')
            params.CalcType.value = item.CalcType
            params.formState2.value.CategoryId = item.Id

            methods.getTableList(true)





        },

        handleLevel3: (item) => {
            params.levelType.value = 3



            params.formState3.value.SubcategoryId = item.Id

            methods.getTableList(true)
        },


        getTemplate: () => {

            Request({
                url: "/performance/GetTemplistList",
                method: 'post',
                params: {
                    Years: params.queryParams.value.year,
                    TypeId: params.cIndex.value
                }
            }).then(res => {


                params.list.value = res.Data[0].NodeList
                params.templateOpen.value = true
            })
        },



        getTableTypeList: () => {
            const key = `${window.location.pathname}Index`;
            const storedValue = Storage.get(key, true); // 获取原始值（字符串或 null）

            if (storedValue !== null && storedValue !== undefined && !isNaN(storedValue)) {
                params.cDateIndex.value = +Storage.get(`${window.location.pathname}Index`, true)
            }
  
            Request({
                url: "/performance/getperformacetype",
                method: 'post',
                data: {
                    BType: params.cDateIndex.value
                }

            }).then(res => {
                params.tabList.value = res.Data.map(e => {
                    return {
                        label: e.TypeName,
                        value: e.Id
                    }
                })



                methods.getTableList(true)
            })

        },

        init: () => {
              getBrowserInfo().catch(err => { console.log(err)})
            if (proxy) {
                params.proxy.value = proxy
            }
            const { message } = antd
            params.messageTest.value = message
            params.messageTest.value.config({
                top: `10vh`,
                duration: 7,
                maxCount: 1,
                rtl: true,
            });

            let cyear = dayjs(Date.now()).format('YYYY')
            let cmonth= +dayjs(Date.now()).format('M')
            params.yearList.value = getRecentYears()
   
            params.queryParams.value.year = cyear
            params.queryParams.value.month = cmonth
            let info = Storage.get('AccountInfo', true)
            Request({
                url: "/Account/createJwtToken",
                method: 'post',
                data: {
                    "userName": info && info.UserNo
                }
            }).then(res => {
                Storage.set('token', res.Data,true)
                    

                methods.getTableTypeList()

                console.log(params.cDateIndex.value,'')







            })

      
        

     
         
        },

 

    }


   
    const template = {
        testTable: {
            template: `
           <template v-if='item&&item.children&&item.children.length!=0'>
                                <table >
                          
                                    <tr v-for="(ess,iss) in item.children">
                                        <td v-if="iss==0" :rowspan="item.children.length">{{item.text}}-{{item.children.length}}</td>
                                        <td >{{ess.text}}</td>
                                    </tr>

                                </table>
                            </template>


                            <template v-else>
                                {{item.text}}
                            </template>
`,
            props: [
                "list",
                "item"
            ],
            setup(props, { emit }) {
             
   

                const item = props.item

         
                console.log(item)
                return {
                    item: item,
                    ...params,
                    ...methods,
                };
            }

        }
    }
    return {
        ...params,
        ...methods,
        template
    }
}
export default Composition